package com.duduwolf.handgis.service;

import java.io.InputStream;
import java.util.Properties;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.duduwolf.util.TextFile;

public class XMLTreeHandler implements TreeHandler {

	private static final String applicationProperties = "/application.properties";
	private static final Properties properties;
	static {
		properties = new Properties();
		InputStream stream =
			XMLTreeHandler.class.getResourceAsStream(applicationProperties);
		try {
			properties.load(stream);
		} catch (Exception e) {

		}
		properties.putAll(System.getProperties());
	}
	
	public String treeHandle() {
		String fileName = properties.getProperty(treeXMLFile);
		TextFile file = new TextFile(TextFile.getAppPath(TextFile.class) + fileName);
		return file.getText("UTF-8");
	}

	static final Logger log = LoggerFactory.getLogger(XMLTreeHandler.class);
	private static final String treeXMLFile = "tree.xml.file";
}
